package cn.mxlshy.springcloud.controller;

import cn.mxlshy.springcloud.service.PaymentFeignService;
import entities.CommonResult;
import entities.Payment;
import lombok.Data;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author: 马晓亮
 * @date: 2020/8/7 14:57
 * @description:
 */
@RestController
public class OrderFeignController {
    @Resource
    private PaymentFeignService paymentFeignService;

    @GetMapping("/consumer/payment/get/{id}")
    public CommonResult<Payment> getPaymentById(@PathVariable Long id) {
        return paymentFeignService.getPayment(id);
    }

    @GetMapping("/consumer/payment/feign/timeout")
    public String paymentFeignTimeout() {
        //openfeign-ribbon，客户端默认等待1秒钟
        return paymentFeignService.paymentFeignTimeout();
    }
}
